<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateMoneyLogTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('money_log', function (Blueprint $table) {
            $table->increments('id');
            $table->integer('user_id')->comment('用户id');
            $table->string('name')->comment('资金记录名称');
            $table->decimal('money')->comment('变动金额');
            $table->enum('type', ['fund', 'stock', 'radio', 'same', 'area'])->comment('奖金类型');
            $table->boolean('change_type')->default(true)->comment('变动类型:true-增加，false-减少');
            $table->string('order_no')->comment('关联订单号');
            $table->integer('buy_user')->comment('购买人');
            $table->string('money_no')->comment('资金记录单号');
            $table->timestamp('pay_at', 0)->nullable()->comment('领取时间');
            $table->boolean('pay_status')->default(false)->comment('领取状态');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('money_log');
    }
}
